package com.night.xjh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.night.common.entity.xjh.Header;
import com.night.xjh.mapper.HeaderMapper;
import com.night.xjh.service.HeaderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: HeaderServiceImpl
 * @Description: //TODO
 * @author: xjh
 * @date: 2022/10/21-16:44
 * @version: v1.0
 */
@Service
public class HeaderServiceImpl implements HeaderService {
    @Resource
    private HeaderMapper headerMapper;
    public void add(Header header) {
        headerMapper.add(header);
    }

    public void delete(int id) {
        headerMapper.delete(id);
    }

    public void update(Header header) {
        headerMapper.update(header);
    }

    public PageInfo<Header> getAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Header> list=headerMapper.getAll();
        return new PageInfo<Header>(list);
    }

    public Header getById(int id) {
        return headerMapper.getById(id);
    }

    public PageInfo<Header> getByCondition(Header header, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Header> list=headerMapper.getByCondition(header);
        return new PageInfo<Header>(list);
    }
}
